import request from '@/utils/request';

//商品分类类型树
export function getTree(){
    return request({
        url: '/app/products/tree',
        method: 'get',
    });
}

// 分页查询-商品
export function listProducts (query: any) {
    return request({
        url: '/app/products/list',
        method: 'get',
        params: query,
    });
}

// 根据id获取
export function getProductById(id: any){
    return request({
        url: '/app/products/' + id,
        method: 'get',
    });
}

// 添加
export function addProduct(data: any){
    return request({
        url: '/app/products',
        method: 'post',
        data,
    });
}

//删除

export function deleteProduct(id: any){
    return request({
        url: '/app/products/' + id,
        method: 'delete',
    });
}

//修改

export function updateProduct(data: any){
    return request({
        url: '/app/products',
        method: 'put',
        data,
    });
}
